package com.qg.wcsopcuaqj.business.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qg.wcsopcuaqj.business.entity.TWcsTaskLog;

import com.qg.wcsopcuaqj.business.mapper.TWcsTaskLogMapper;
import com.qg.wcsopcuaqj.business.params.WcsTaskLogQueryParam;
import com.qg.wcsopcuaqj.business.service.ITWcsTaskLogService;
import com.qg.wcsopcuaqj.common.param.IdParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * wcs 任务信息日志表 服务实现类
 * </p>
 *
 * @author caixiang
 * @since 2021-10-09
 */
@Service
public class TWcsTaskLogServiceImpl extends ServiceImpl<TWcsTaskLogMapper, TWcsTaskLog> implements ITWcsTaskLogService {
    @Autowired
    TWcsTaskLogMapper mapper;

    @Override
    public IPage<TWcsTaskLog> findAll(WcsTaskLogQueryParam taskLogQueryParam) {
        IPage<TWcsTaskLog> all = mapper.findAll(
                new Page<TWcsTaskLog>(taskLogQueryParam.getCurrent(), taskLogQueryParam.getSize())
        );
        return all;
    }

    @Override
    public Boolean create(TWcsTaskLog tWcsTaskLog) {
        return mapper.insertSelective(tWcsTaskLog) == 1;
    }

    @Override
    public Boolean update(TWcsTaskLog tWcsTaskLog) {
        return mapper.updateById(tWcsTaskLog, tWcsTaskLog.getId()) == 1;
    }

    @Override
    public Boolean delete(IdParam idParam) {
        return mapper.deleteById(idParam.getId()) == 1;
    }

    @Override
    public TWcsTaskLog findById(IdParam idParam) {
        return mapper.findById(idParam.getId());
    }
}
